<?php

/**
 * OntoWiki tag cloud template
 */
$odd = false;
?>

<?php if (!empty($this->message)): ?>
    <?php if (!empty($this->messagetype)): ?>
        <span class="messagebox <?php echo $this->messagetype ?>"><?php echo ($this->message) ?></span>
    <?php else: ?>
        <span class="messagebox info"><?php echo ($this->message) ?></span>
    <?php endif ?>    
<?php else: ?>
    <ul class="bullets-none separated">
    <?php foreach ($this->tags as $cloud) : ?>
        <li class="<?php echo $odd ? 'odd' : 'even'; $odd = !$odd; ?> has-contextmenu-area">
            <?php echo $cloud["info"]["label"];
            if($cloud["info"]["isInverse"]){
                echo '<sup>-1</sup>';
            } ?>
        <ol title="<?php echo $cloud["info"]["label"];?>"
            about="<?php echo $cloud["info"]["uri"] ?>"
            class="inline separated
                <?php if($cloud["info"]["isInverse"]){ echo ' InverseProperty';}?>"
            >
        <?php foreach ($cloud["data"] as $key => $value):  ?>
            <li><a value="<?php echo $value['value'] ?>"
                   <?php if($value['type']=='uri'): ?>
                        about="<?php echo $value['value'] ?>"
                   <?php endif; ?>
                   type="<?php echo $value['type']; ?>"
                   datatype="<?php if(isset($value['datatype'])) echo $value['datatype']; ?>" 
                   language="<?php if(isset($value['xml:lang'])) echo $value['xml:lang']; ?>"
                   class="cloudvalue tagweight<?php echo $value['weight'] ?>
                         <?php if($value['selected']){echo "selected";} ?>"
                    
                   cloudproperty="<?php echo $cloud["info"]["uri"]; ?>"
                >
                    <?php echo $value['title'] ?>
                </a>
            </li>
        <?php endforeach; ?>
        </ol>
        <?php if(empty($cloud["data"])): ?>
            <div class="messagebox info">
                No tags to generate a tagcloud. Please drag & drop another property from the list below to create an attribute cloud.
            </div>
        <?php endif; ?>
          <div class="contextmenu">
            <span class="item delete-cloudproperty" about="<?php echo $cloud["info"]["uri"] ?>">
                <span class="icon icon-close" title="Close Tagcloud">
                    <span>Close Tagcloud</span>
                </span>
            </span>
          </div>
        </li>
     <?php endforeach; ?>
     </ul>
<?php endif; ?>
